
#include <BScript>
#include "IClassList.h"

using namespace BWE;

ClassList::ClassList() : BClass("list<T>")
{
	this->insertMethod("list<T>()", &ClassList::create);
	this->insertMethod("list<T>(int)", &ClassList::create_size);
	this->insertMethod("list<T>(const T&, int)", &ClassList::create_value_size);
	this->insertMethod("list<T>(const list<T>&)", &ClassList::create_other);
	this->insertMethod("~list<T>()", &ClassList::release);

	this->insertMethod("bool empty() const", &ClassList::empty);
	this->insertMethod("int size() const", &ClassList::size);
	this->insertMethod("void clear()", &ClassList::clear);

	this->insertMethod("bool resize(int)", &ClassList::resize);
	this->insertMethod("bool check(int) const", &ClassList::check);

	this->insertMethod("bool set(int, const T&)", &ClassList::set_pos_value);
	this->insertMethod("bool set(int, const list<T>&)", &ClassList::set_pos_list);

	this->insertMethod("int find(const T&, int) const", &ClassList::find);
	this->insertMethod("int rfind(const T&, int) const", &ClassList::rfind);

	this->insertMethod("int count(const T&) const", &ClassList::count);
	this->insertMethod("int contain(const T&) const", &ClassList::contain);
	this->insertMethod("int replace(const T&, const T&)", &ClassList::replace);

	this->insertMethod("bool move(int, int)", &ClassList::move);
	this->insertMethod("bool swap(int, int)", &ClassList::swap);

	this->insertMethod("bool reverse()", &ClassList::reverse);

	this->insertMethod("bool raise(const T&)", &ClassList::raise);
	this->insertMethod("bool lower(const T&)", &ClassList::lower);

	this->insertMethod("T& first()", &ClassList::first);
	this->insertMethod("const T& first() const", &ClassList::first_const);

	this->insertMethod("T& last()", &ClassList::last);
	this->insertMethod("const T& last() const", &ClassList::last_const);

	this->insertMethod("T& middle()", &ClassList::middle);
	this->insertMethod("const T& middle() const", &ClassList::middle_const);

	this->insertMethod("T& at(int)", &ClassList::at_index);
	this->insertMethod("const T& at(int) const", &ClassList::at_index_const);

	this->insertMethod("T& append()", &ClassList::append);
	this->insertMethod("bool append(T)", &ClassList::append_value_size);
	this->insertMethod("bool append(const T&, int)", &ClassList::append_value_size);

	this->insertMethod("bool prepend()", &ClassList::prepend);
	this->insertMethod("bool prepend(T)", &ClassList::prepend_value);
	this->insertMethod("bool prepend(const T&, int)", &ClassList::prepend_value_size);

	this->insertMethod("T& insert(int)", &ClassList::insert_pos);
	this->insertMethod("bool insert(int, const T&, int)", &ClassList::insert_pos_value_size);

	this->insertMethod("bool remove(int, int)", &ClassList::remove_pos_count);
	this->insertMethod("bool remove(const T&)", &ClassList::remove_value);
	this->insertMethod("bool remove(const list<T>&)", &ClassList::remove_other);

	this->insertMethod("T& ()(int)", &ClassList::operator_bracket);
	this->insertMethod("T& [](int)", &ClassList::operator_square_bracket);

	this->insertMethod("const list<T>& =(const list<T>&)", &ClassList::operator_assign);

	this->insertMethod("list<T> +(const T&)", &ClassList::operator_plus_value);
	this->insertMethod("list<T> +(const list<T>&)", &ClassList::operator_plus_list);

	this->insertMethod("void +=(const T&)", &ClassList::operator_plus_equal_value);
	this->insertMethod("void -=(const T&)", &ClassList::operator_minus_equal_value);

	this->insertMethod("list<T>& <<(const T&)", &ClassList::operator_append_value);
	this->insertMethod("list<T>& <<(const list<T>&)", &ClassList::operator_append_list);

	this->insertMethod("bool ==(const list<T>&) const", &ClassList::operator_equal);
	this->insertMethod("bool !=(const list<T>&) const", &ClassList::operator_unequal);
}

BClass* ClassList::clone() const
{
	ClassList* cls = new ClassList();
	cls->copy(this);
	return cls;
}

void ClassList::create(int argc, BValue* argv)
{
	BValueList* list = new BValueList();
	this->setAsset(list);
}
void ClassList::create_size(int argc, BValue* argv)
{
	int size = argv[1];
	BValueList* list = new BValueList(size);
	this->setAsset(list);
}
void ClassList::create_value_size(int argc, BValue* argv)
{
	const BValue& value = argv[1];
	int size = argv[2];
	BValueList* list = new BValueList(value, size);
	this->setAsset(list);
}
void ClassList::create_other(int argc, BValue* argv)
{
	BValueList* list = new BValueList();
	if (BClass* otherList = argv[1])
	{
		const BValueList& other = otherList->asset();
		*list = other;
	}
	this->setAsset(list);
}
void ClassList::release(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	list.clear();
}

void ClassList::size(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.size();
}
void ClassList::empty(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.empty();
}
void ClassList::clear(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	list.clear();
}

void ClassList::resize(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int size = argv[1];
	list.resize(size);
}
void ClassList::check(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	int index = argv[1];
	argv[0] = list.check(index);
}

void ClassList::set_pos_value(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int pos = argv[1];
	const BValue& value = argv[2];
	list.set(pos, value);
}
void ClassList::set_pos_list(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int pos = argv[1];
	if (ClassList* otherList = argv[2])
	{
		const BValueList& other = otherList->asset();
		list.set(pos, other);
	}
}

void ClassList::find(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	const BValue& value = argv[1];
	auto it = list.find(value);
	argv[0] = it.index();
}
void ClassList::rfind(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	const BValue& value = argv[1];
	auto it = list.rfind(value);
	argv[0] = it.index();
}

void ClassList::count(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.count(value);
}
void ClassList::contain(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.contain(value);
}
void ClassList::replace(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	const BValue& oldValue = argv[1];
	const BValue& newValue = argv[1];
	argv[0] = list.replace(oldValue, newValue);
}

void ClassList::move(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int index = argv[1];
	int dest = argv[2];
	argv[0] = list.move(index, dest);
}
void ClassList::swap(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int indexA = argv[1];
	int indexB = argv[2];
	argv[0] = list.swap(indexA, indexB);
}

void ClassList::reverse(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	//list.reverse();
}

void ClassList::raise(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.raise(value);
}
void ClassList::lower(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.lower(value);
}

void ClassList::sort_dir(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int dir = argv[1];
	argv[0] = list.sort(dir);
}

void ClassList::find_min(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	auto it = list.find_min();
	argv[0] = it.index();
}
void ClassList::find_max(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	auto it = list.find_max();
	argv[0] = it.index();
}

void ClassList::index_value(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.index(value);
}

void ClassList::first(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.first();
}
void ClassList::first_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.first();
}

void ClassList::middle(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.middle();
}
void ClassList::middle_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.middle();
}

void ClassList::last(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.last();
}
void ClassList::last_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.last();
}

void ClassList::min(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.min();
}
void ClassList::min_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.min();
}

void ClassList::max(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.max();
}
void ClassList::max_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	argv[0] = list.max();
}

void ClassList::at_index(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	int index = argv[1];
	argv[0] = list.at(index);
}
void ClassList::at_index_const(int argc, BValue* argv)
{
	const BValueList& list = this->asset();
	int index = argv[1];
	argv[0] = list.at(index);
}

void ClassList::prepend(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0] = list.prepend();
}
void ClassList::prepend_value(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	const BValue& value = argv[1];
	argv[0] = list.prepend(value);
}
void ClassList::prepend_value_size(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	const BValue& value = argv[1];
	int size = argv[2];
	argv[0] = list.prepend(value, size);
}
void ClassList::prepend_other(int argc, BValue* argv)
{
	BValueList& list = this->asset();
	argv[0].clear();
	if (ClassList* otherList = argv[1])
	{
		const BValueList& other = otherList->asset();
		argv[0] = list.prepend(other);
	}
}

void ClassList::append(int argc, BValue* argv)
{
	
}
void ClassList::append_value(int argc, BValue* argv)
{

}
void ClassList::append_value_size(int argc, BValue* argv)
{
	
}
void ClassList::append_list_size(int argc, BValue* argv)
{
	
}
void ClassList::append_other(int argc, BValue* argv)
{
	
}

void ClassList::insert_pos(int argc, BValue* argv)
{
	
}
void ClassList::insert_pos_value_size(int argc, BValue* argv)
{
	
}

void ClassList::insert_pos_list_size(int argc, BValue* argv)
{
	
}
void ClassList::insert_pos_other(int argc, BValue* argv)
{
	
}

void ClassList::insert_it(int argc, BValue* argv)
{
	
}
void ClassList::insert_value_size(int argc, BValue* argv)
{
	
}

void ClassList::insert_it_list_size(int argc, BValue* argv)
{
	
}
void ClassList::insert_it_other(int argc, BValue* argv)
{
	
}

void ClassList::remove_pos_count(int argc, BValue* argv)
{
	
}
void ClassList::remove_value(int argc, BValue* argv)
{
	
}

void ClassList::remove_list_size(int argc, BValue* argv)
{
	
}
void ClassList::remove_other(int argc, BValue* argv)
{
	
}

void ClassList::removeAll_value(int argc, BValue* argv)
{
	
}
void ClassList::removeAll_other(int argc, BValue* argv)
{
	
}

void ClassList::push(int argc, BValue* argv)
{
	
}
void ClassList::push_value(int argc, BValue* argv)
{
	
}

void ClassList::pop(int argc, BValue* argv)
{
	
}
void ClassList::pop_value(int argc, BValue* argv)
{
	
}

void ClassList::erase(int argc, BValue* argv)
{
	
}

void ClassList::erase_begin_end(int argc, BValue* argv)
{
	
}

void ClassList::begin(int argc, BValue* argv)
{
	
}
void ClassList::seek(int argc, BValue* argv)
{
	
}
void ClassList::end(int argc, BValue* argv)
{
	
}

void ClassList::begin_const(int argc, BValue* argv)
{
	
}
void ClassList::seek_const(int argc, BValue* argv)
{
	
}
void ClassList::end_const(int argc, BValue* argv)
{
	
}

void ClassList::rbegin(int argc, BValue* argv)
{
	
}
void ClassList::rseek(int argc, BValue* argv)
{
	
}
void ClassList::rend(int argc, BValue* argv)
{
	
}

void ClassList::rbegin_const(int argc, BValue* argv)
{
	
}
void ClassList::rseek_const(int argc, BValue* argv)
{
	
}
void ClassList::rend_const(int argc, BValue* argv)
{
	
}

void ClassList::operator_assign(int argc, BValue* argv)
{
	
}

void ClassList::operator_plus_value(int argc, BValue* argv)
{

}
void ClassList::operator_plus_list(int argc, BValue* argv)
{

}

void ClassList::operator_plus_equal_value(int argc, BValue* argv)
{
	
}
void ClassList::operator_plus_equal_list(int argc, BValue* argv)
{
	
}

void ClassList::operator_minus_equal_value(int argc, BValue* argv)
{

}
void ClassList::operator_minus_equal_list(int argc, BValue* argv)
{

}

void ClassList::operator_bracket(int argc, BValue* argv)
{
	
}
void ClassList::operator_bracket_const(int argc, BValue* argv)
{
	
}

void ClassList::operator_square_bracket(int argc, BValue* argv)
{
	
}
void ClassList::operator_square_bracket_const(int argc, BValue* argv)
{
	
}

void ClassList::operator_append_value(int argc, BValue* argv)
{

}
void ClassList::operator_append_list(int argc, BValue* argv)
{

}
void ClassList::operator_equal(int argc, BValue* argv)
{

}
void ClassList::operator_unequal(int argc, BValue* argv)
{

}
